<template>
  <van-empty :image="imagePath">
    <p>您没有权限访问当前页面，<span style="color:red">{{sec}}</span>秒后直接跳转登录页面</p>
    <van-button round type="primary" class="bottom-button" @click="toHome"
      >直接跳转登录</van-button
    >
  </van-empty>
</template>

<script setup>
import { ref } from 'vue';
import { useRoute } from 'vue-router';
const imagePath = new URL('~/401.png', import.meta.url).href;
function toHome() {
  window.location.href = '/login';
}

let sec = ref(3);
setInterval(() => {
  sec.value--;
  if (sec.value <= 0) {
    window.location.href = '/login';
  }
}, 1000);


</script>

<style></style>
